const express = require("express");
const getSendData = require("../utils/getSendData");
const { getCaptcha } = require("../services/captchaService");

const router = express.Router();

router.get("/", async (req, res, next) => {
    const captcha = await getCaptcha();
    req.session.captcha = captcha.text.toLowerCase();
    res.setHeader("Content-Type", "image/svg+xml");
    res.send(captcha.data);
});

module.exports = router;
